<template>
  <div class="container page">

    <div style="padding: 10rpx"></div>

<div style="margin: 30rpx;background-color:#f7f7f7;">
    <div class="draw">
      <p>可提现金额</p>
      <p>已结算佣金</p>
    </div>
    <div class="draw">
      <p>{{yuE}}元</p>
      <p>{{jieSuan}}元</p>
    </div>
</div>
    <div style="margin: 50rpx"></div>
    <div class="draw">
      <p style="background-color:#000;color:#f7f7f7;margin: 0 50rpx" @click="partnerpayment">提现记录</p>
      <p style="background-color:#000;color:#f7f7f7;margin: 0 50rpx" @click="partnerdrawapply">提现申请</p>
    </div>

    <div style="margin: 50rpx 0;padding: 10rpx;background-color:#eee;"></div>

  <div class="recomond">
    <p v-bind:class="{choose: tabA === 0}" v-on:click="chooseTab(0)">全部</p>
    <p v-bind:class="{choose: tabA === 1}" v-on:click="chooseTab(1)">今日</p>
    <p v-bind:class="{choose: tabA === 7}" v-on:click="chooseTab(7)">近7日</p>
    <p v-bind:class="{choose: tabA === 30}" v-on:click="chooseTab(30)">近30日</p>
    <!-- <p v-bind:class="{choose: tabA === 100008}" v-on:click="chooseTab(100008)">面膜</p> -->
  </div>

    <div style="margin: 50rpx"></div>

<div style="margin: 30rpx;background-color:#f7f7f7;">
    <div class="draw">
      <p>付款订单</p>
      <p>客户付款金额</p>
      <p>预估佣金收入</p>
    </div>
    <div class="draw">
      <p>{{info.danshu}}笔</p>
      <p>{{info.fukuan}}元</p>
      <p>{{info.yingli}}元</p>
    </div>
    <div style="background-color:#fff;padding: 20rpx;"></div>
</div>

<!-- <div style="margin: 50rpx 0;padding: 30rpx;background-color:#f7f7f7;"></div>

<div style="background-color:#fff;padding: 200rpx;"></div> -->

  </div>
</template>
<script>
// var WXBizDataCrypt = require('@/tools/WXBizDataCrypt')
import qcloud from 'wafer2-client-sdk'

import {showSuccess, showModal} from '@/util'
import {get, post, getAuth} from '@/util'
// import {get2, post2} from '@/server/api'
import config from '@/config'
export default {

  data () {
    return {
      info:[],
      tabA: 0,
      yuE:'',
      jieSuan: '',
      shippingInfo: {},
      shippingid: '',
      tabA: 0,
      listIncome: [{
          SalesBalance: 0,
          profit: 0}],
      focus: true,
      inputValue: ''
    }
  },
  mounted () {
    this.userinfo = wx.getStorageSync('userinfo')
  },
  onShareAppMessage() {
    return {
      title: `华人耀酱香型白酒，传承古法工艺，与国酒茅台同宗同源同品。`,
      // imageUrl: 'https://www.rrjiaoyi.com/static/rr-min/share/share.png',
      path: `/pages/hcdindex/main?shareuser=${wx.getStorageSync('user').id}`
    }
  },
  methods: {
    partnerdrawapply(){
      wx.navigateTo({
        url: `/pages/partnerdrawapply/main`
      })
    },
    partnerpayment(){
      wx.navigateTo({
        url: `/pages/partnerpayment/main`
      })
    },
    chooseTab(x) {
      this.tabA = x;
      if(x === 0) {
        this.get_info("");
      } else {
        this.get_info(x);
      }
    },
    async get_info(timerang) {
      return await getAuth(`geweb/partner/selectDinDan?userId=${JSON.parse(wx.getStorageSync('user').id)}&timerang=${timerang}`, {}, {}).then(result => {

        if(result.code === 200) {
            console.log(result.res)
            // console.log(result.res[0])
            this.info = result.res[0];
            // wx.hideLoading();
        }
      })
    },
    async settle() {
      return await getAuth(`geweb/partner/selectJieSuan?userId=${JSON.parse(wx.getStorageSync('user').id)}`, {}, {}).then(result => {

        // if(result.code === 301) {
        //   wx.switchTab({
        //     url: `/pages/usercenter/main`
        //   })
        //   wx.showToast({
        //     title: '请登录',
        //     icon: 'none'
        //   })
        // }
        this.jieSuan = result;

        // if(result.code === 200) {
        //     console.log(result)
        //     this.jieSuan = result.res;
        // }

      })
    },
    async remain() {
      return await getAuth(`geweb/partner/selectYuE?userId=${JSON.parse(wx.getStorageSync('user').id)}`, {}, {}).then(result => {

        // if(result.code === 301) {
        //   wx.switchTab({
        //     url: `/pages/usercenter/main`
        //   })
        //   wx.showToast({
        //     title: '请登录',
        //     icon: 'none'
        //   })
        // }
            this.yuE = result;

        // if(result.code === 200) {
        //     console.log(result)
        //     this.yuE = result.res;
        // }
      })
    },
    payment() {
      wx.navigateTo({
        url: `/pages/partnerpayment/main`
      })
    },
    earning() {
      wx.navigateTo({
        url: `/pages/partnerOrderEarning/main`
      })
    },
    productChoose (id) {
      // console.log(name, img, userId, accountId)
      wx.navigateTo({
        url: `/pages/product-detail/main?id=${id}`
      })
    },
    async player() {
      return await post('minipro/List', {}, {'api':'all', 'page':1})
    },
    async demo() {
    // return await get2('demo', {})
    },
    async joke() {
      return await get2('api/jokes', {})
    },
    predict () {
      wx.navigateTo({
        url: '/pages/search/main'
      })
    },
    jumpClick (comment) {
      wx.navigateTo({
        // url: '/pages/web-view/main'
        url: '/pages/web-view/main?path=' + 'https://wj.qq.com/s/2491547/f457/'
        // url: '/pages/detail/main'
      })
    }

  },
  onShow () {
      this.settle()
      this.remain()
      this.get_info("");

  }
}
</script>

<style scoped lang='scss'>
.container{
  font-size: 30rpx;
  background-color:#fff;
}
page {
  // background-color: #ffffff;
  background-color:#fff;
  width: 100%;
  height: 100%;
}
.draw{
  display:flex;
  text-align:center;
  height: 80rpx;
  line-height: 80rpx;
  p {
    flex:1
    }
}
.recomond {
  margin: 0 40rpx;
  margin-top: 40rpx;
  height: 60rpx;
  line-height: 60rpx;
  text-align: center;
  display: flex;
  p {
    flex: 1;
  }
}
.choose {
  // color: #78b8ad;
  color: #ffffff;
  background-color: black;
}
</style>
